﻿using BusinessLayer;
using ModelLayer;
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Diagnostics;
using DAL;

namespace UnitTestLayer
{
    [TestClass]
    public class ShoppingListTest
    {
        //[TestMethod]
        //public void CreateShoppingList()
        //{
        //  //Tests if a shopping list is created.
        //    IFShoppingListB ifShoppingListB = new ShoppingListB();

        //    ifShoppingListB.CreateShoppingList(59 ,"Liste 5", 1386828000);
        //}

        //[TestMethod]
        //public void RemoveShoppingList()
        //{

        //    //Tests if a shopping list is deleted.
        //    IFShoppingListB ifShoppingListB = new ShoppingListB();

        //    ifShoppingListB.RemoveShoppingList(2);
        //}

        //[TestMethod]
        //public void AddUserToShoppingList()
        //{
        //    IFShoppingListB ifShoppingListB = new ShoppingListB();

        //    ifShoppingListB.AddUserToShoppingList(6, 4);

        //    ShoppingListDB shoppingListDB = new ShoppingListDB();

        //    shoppingListDB.DeleteUserFromShoppingList(6, 4);
        //}

        //[TestMethod]
        //public void DeleteUserFromShoppingList()
        //{
        //    IFShoppingListB ifShoppingListB = new ShoppingListB();

        //    ifShoppingListB.AddUserToShoppingList(5, 5);

        //    ifShoppingListB.DeleteUserFromShoppingList(5, 5);
        //}

        //[TestMethod]
        //public void AddProductToList()
        //{
        //    IFShoppingListB l = new ShoppingListB();
        //    l.AddProductToShoppingList(2, 1, 2);
        //    DeleteProductFromList();
        //}

        //[TestMethod]
        //public void DeleteProductFromList()
        //{
        //    AddProductToList();
        //    IFShoppingListB l = new ShoppingListB();
        //    l.DeleteProductFromShoppingList(2, 1);
        //}

        [TestMethod]
        public void MarkProductAsBought()
        {
            IFShoppingListB l = new ShoppingListB();
            l.MarkAsBought(6, 1);
        }

        [TestMethod]
        public void GetShoppingLists()
        {
            IFShoppingListB l = new ShoppingListB();
            var list = l.GetShoppingListsWithUname("Test4");
            foreach (ModelLayer.ShoppingList shoppingList in list)
            {
                Debug.WriteLine(shoppingList.ShoppingListName);
            }

        }

        [TestMethod]
        public void GetProductsInList()
        {
            IFShoppingListB l = new ShoppingListB();
            var list = l.GetProductsWithListId(55);
            foreach (var product in list)
            {
                Debug.WriteLine(product.ProductName);
            }
        }
        [TestMethod]
        public void GetSharedUsersInList()
        {
            IFShoppingListB l = new ShoppingListB();
            var list = l.GetSharedUsersForShoppingList("cbjerg", 51);
            foreach (var user in list)
            {
                Debug.WriteLine(user.UserName);
            }
        }
    }
}
